package com.carl.service;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Service;

import com.carl.bean.Menu;
import com.carl.dao.MenuDao;
import com.google.code.morphia.Key;

@Service
public class MenuService {
	private MenuDao menuDao;
	
	@Resource
	public void setMenuDao(MenuDao dao){
		this.menuDao = dao;
	}

	/**
	 * 保存一个菜单信息
	 * @param menu
	 * @return
	 */
	public String saveUser(Menu menu){
		Key<Menu> keyInfo = menuDao.save(menu);
		return keyInfo.toString();
	};
	
	/**
	 * 查找所有的子节点菜单
	 * @param nodeId
	 * @return
	 */
	public List<Menu> findMenuByNodeId(Integer nodeId){
		return menuDao.findMenuByNodeId(nodeId);
	}
}
